 import timeit
def sort(w):
   s = False
   for i in range(len(w),0,-1):
       s = False
       for j in range(0,i-1):
           if (w[j] > w[j+1]):
               t = w[j]
               w[j] = w[j+1]
               w[j+1] = t
               s = True
       if not s:
           return w


a = list(map(int, open("m1_sorted.txt").read().splitlines()))


b = list(map(int, open("m2_reverse.txt").read().splitlines()))


c = list(map(int, open("m3_shuffle.txt").read().splitlines()))


print("m1_sorted",str(int(timeit.timeit("sort(a)", "from __main__ import a,sort", number=1)*1000)),"milliseconds")


print("m2_reverse",str(int(timeit.timeit("sort(b)", "from __main__ import b,sort", number=1)*1000)),"milliseconds")


print("m3_shuffle",str(int(timeit.timeit("sort(c)", "from __main__ import c,sort", number=1)*1000)),"milliseconds")
